home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
newsgroups
/
misc.20041116-20060924
/
000335_fdc@columbia.edu_Fri May 5 11:23:30 2006.msg
< prev
next >
Wrap
Internet Message Format
|
2020-01-01
|
3KB
Path: newsmaster.cc.columbia.edu!not-for-mail
From: Frank da Cruz <fdc@columbia.edu>
Newsgroups: comp.protocols.kermit.misc
Subject: Re: using FILE OPEN quadruples memory usage!
Date: 5 May 2006 15:23:17 GMT
Organization: Columbia University
Lines: 50
Message-ID: <slrne5mrf5.lbf.fdc@sesame.cc.columbia.edu>
References: <1146783231.532130.44080@v46g2000cwv.googlegroups.com>
Reply-To: fdc@columbia.edu
NNTP-Posting-Host: sesame.cc.columbia.edu
X-Trace: newsmaster.cc.columbia.edu 1146842597 27247 128.59.59.56 (5 May 2006 15:23:17 GMT)
X-Complaints-To: postmaster@columbia.edu
NNTP-Posting-Date: 5 May 2006 15:23:17 GMT
User-Agent: slrn/0.9.8.0 (SunOS)
Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:15592
On 2006-05-04, tomviolin <rock_spambust_violin@yahoo.com> wrote:
: I have discovered that using FILE OPEN in C-Kermit 8.0.211 causes
: Kermit's memory usage to quadruple. The memory usage does not go back
: down after the file(s) are closed, either.
:
: This memory explosion does NOT appear to occur when the "old" OPEN FILE
: method is used, only with the "new" FILE OPEN method. So it is
: possible to work around it, albeit inconveniently at times.
:
: Further openings of files do not appear to result in further memory
: expansion. I was able to have multiple files open using FILE OPEN and
: it did not proceed to octuple memory usage, for example.
:
The FILE OPEN code is in ckuus7.c within #ifdef CKCHANNELIO..#endif,
about 1640 lines that I wrote six years ago. There's a spot where we
malloc z_maxchan times sizeof(struct ckz_file), which includes a filename
buffer of about 1K. This happens once, the first time FILE OPEN is used.
Probably this storage is never deallocated, since a new file might be
opened at any time. When I wrote the code, the maximum number of open files
per process (as reported by sysconf) was usually a small number, less than
100. Now I see that in current Linuxes, it's more like 1000. So that would
account for about a megabyte.
: I'm using Kermit compiled for ARM with "make linuxnc KFLAGS=-DNOBIGBUF"
: (I'm trying to save memory!) and running on a 32M embedded board
: running the Linux 2.4.26-ts9 kernel.
:
: How can this be happening if FILE OPEN is simply a front-end for the
: fopen() system call?
:
It does its own bookkeeping, has its own mini-FILE struct for each channel.
: I could see memory on the order of kilobytes
: being allocated, but we're talking several megabytes of memory being
: consumed here, just from opening a text file.
:
In Linux (in this case Red Hat AS 4 on AMD-64), if I start Kermit, log debug,
do an FOPEN, exit, and then "grep z_maxchan debug.log" I see:
z_open z_maxchan 1=-2
z_open z_maxchan 2=1006
z_open z_maxchan 3=1006
1006 is the number of mini-FILE structs that are allocated. I can see that
this could be done with a big more finesse. It wasn't an issue before. I'll
see what I can do in the next 8.0.212 development upload:
http://www.columbia.edu/kermit/ckdaily.html
- Frank